package com.prs.crm.domain.oa;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.hr.Person;

@Entity
@Table(name="oa_worksummary")
public class WorkSummary extends BaseEntity{
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	@ManyToOne
	private WorkSummaryType type;
	@ManyToOne
	private Person auditPerson;
	@ManyToOne
	private Person referPerson;
	
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	@ManyToMany(fetch=FetchType.LAZY)
	private Set<Person> copyToPersons;	
	@Lob
	private String summary;
	@Lob
	private String result;
	@Lob
	private String plan;
	private String attach;
	@Lob
	private String remark;
	@Lob
	private String critique;
	private String state;
	private String title;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="workSummary")
	private Set<WorkSummaryAudit> workSummaryAudits;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="workSummary")
	private Set<WorkSummaryCritique> workSummaryCritiques;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public WorkSummaryType getType() {
		return type;
	}
	public void setType(WorkSummaryType type) {
		this.type = type;
	}
	public Person getAuditPerson() {
		return auditPerson;
	}
	public void setAuditPerson(Person auditPerson) {
		this.auditPerson = auditPerson;
	}
	public Person getReferPerson() {
		return referPerson;
	}
	public void setReferPerson(Person referPerson) {
		this.referPerson = referPerson;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getPlan() {
		return plan;
	}
	public void setPlan(String plan) {
		this.plan = plan;
	}
	public String getAttach() {
		return attach;
	}
	public void setAttach(String attach) {
		this.attach = attach;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getCritique() {
		return critique;
	}
	public void setCritique(String critique) {
		this.critique = critique;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getState() {
		return state;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getTitle() {
		return title;
	}
	public void setCopyToPersons(Set<Person> copyToPersons) {
		this.copyToPersons = copyToPersons;
	}
	public Set<Person> getCopyToPersons() {
		return copyToPersons;
	}
	public void addCopyToPersons(Collection<Person> persons) {
		if(copyToPersons == null) {
			copyToPersons = new HashSet<Person>();
		}
		if(persons != null) {
			copyToPersons.addAll(persons);
		}
	}
	public void setWorkSummaryAudits(Set<WorkSummaryAudit> workSummaryAudits) {
		this.workSummaryAudits = workSummaryAudits;
	}
	public Set<WorkSummaryAudit> getWorkSummaryAudits() {
		return workSummaryAudits;
	}
	public void setWorkSummaryCritiques(Set<WorkSummaryCritique> workSummaryCritiques) {
		this.workSummaryCritiques = workSummaryCritiques;
	}
	public Set<WorkSummaryCritique> getWorkSummaryCritiques() {
		return workSummaryCritiques;
	}
}
